/*
 * $Id: SttpCmd.h,v 1.3 2006-04-24 08:42:10 bacon Exp $
 */

#ifndef _XPP_NET_STTPCMD_CLASS_
#define _XPP_NET_STTPCMD_CLASS_

#include <xpp/bas/String.h>
#include <xpp/bas/Array.h>

namespace xpp
{
	namespace net
	{
		
		class SttpCmd: public xpp::bas::Array<xpp::bas::String>
		{
		public:
			SttpCmd (const xp_char_t* n = XP_TEXT("")): 
				xpp::bas::Array<xpp::bas::String> (20, 20), name (n) {}
			SttpCmd (const xpp::bas::String& n): 
				xpp::bas::Array<xpp::bas::String> (20, 20), name (n) {}

			xp_size_t argCount () const
			{
				return size ();
			}

			const xp_char_t* argAt (xp_size_t i) const
			{
				return get(i).buffer();
			}

			xp_size_t argLenAt (xp_size_t i) const
			{
				return get(i).size();
			}

			void addArg (const xp_char_t* n, xp_size_t size)
			{
				addDatum (xpp::bas::String (n, 0, size));
			}

			void setName (const xp_char_t* n, xp_size_t size)
			{
				name.set (n, 0, size);
			}

			bool isNullCmd () const
			{
				return name.size() == 0;
			}

			xpp::bas::String name;
		};

	}
}

#endif
